#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main(){
    int n;
    cin >> n;
    int cnt = 1;
    while(n != 1){
        a[cnt] = n;
        cnt++;
        if (n % 2 == 1){
            n = n * 3 + 1;
        }
        else{
            n = n / 2;
        }
    }
    a[cnt] = 1;
    for (int i = cnt; i >= 1; i--){
        cout << a[i] << " ";
    }
    return 0;
}